﻿using System;
using System.Windows;
using System.Windows.Controls;
using Graphe.Collations;

namespace Graphe.Windows.Controls.Collations
{
    public class NominaSacraControl : StackPanel
    {

        private StackPanel _stackPanelNominaSacraInstances;

        public SacrumCollection NominaSacra { get; set; }

        public void Render()
        {
            Children.Clear();

            TextBlock block = new TextBlock();
            block.Text = "NS:";
            block.Style = CollationsControlStylePicker.FindProperVersionResource("NominaSacraHeader") as Style;

            Children.Add(block);

            _stackPanelNominaSacraInstances = new StackPanel();
            _stackPanelNominaSacraInstances.Style = CollationsControlStylePicker.FindProperVersionResource("NominaSacraInstacesPanelStyle") as Style;
            Children.Add(_stackPanelNominaSacraInstances);

            foreach (Sacrum sacrum in NominaSacra)
            {
                SacrumControl sacrumControl = new SacrumControl();
                sacrumControl.Sacrum = sacrum;
                sacrumControl.Render();
                _stackPanelNominaSacraInstances.Children.Add(sacrumControl);
            }
        }
    }
}
